﻿Namespace AboutDNN.DNNMVC


    ''' <summary>
    ''' Static parameters used throughtout the application
    ''' </summary>
    Partial Public Class Params

        ''' <summary>
        ''' Adds a prefix to a key to make it unique for this module.
        ''' </summary>
        ''' <param name="key">The key to append the prefix to</param>
        ''' <returns>The new key with the prefix</returns>
        Public Shared Function AddQualifier(ByVal key As String) As String
            Return App.ModuleFolderName + ":BigfootMVC:" + key
        End Function

        Public Const Controller As String = App.ModuleFolderName & "_routec"
        Public Const Action As String = App.ModuleFolderName & "_routea"
        Public Const TabId As String = App.ModuleFolderName & "_routetid"
        Public Const PortalId As String = App.ModuleFolderName & "_routepid"
        Public Const ModuleId As String = App.ModuleFolderName & "_routemid"

        Partial Public Class Cache
            Public Shared DNNHelper As String = AddQualifier("DNNHelper")

            Public Shared Function DataFolder(ByVal PortalID As Integer) As String
                Return AddQualifier("DataFolderPath:PortalID:" & PortalID)
            End Function

            Public Shared DB As String = AddQualifier("DB")

            ' This is stored in the HTTPRequest
            Public Shared RequestContext As String = AddQualifier("RequestContext")
            Public Shared RequestContextData As String = AddQualifier("RequestContextData")

            ' This is an application wide setting
            Public Shared ProviderConfiguration As String = AddQualifier("ProviderConfiguration")

            Public Shared ManualContext As String = AddQualifier("ManualContext")

            Public Shared Function User(ByVal userName As String) As String
                Return AddQualifier("UserIDFor:" & userName)
            End Function

        End Class

        ''' <summary>
        ''' Http Header names used through out the application
        ''' </summary>
        Public Class HttpHeaders

            ''' <summary>
            ''' Used by the client ajax liabrary to signal to the webserver that this is an ajax request.
            ''' </summary>
            Public Shared ajaxRequest As String = "ajaxRequest"

        End Class

    End Class


End Namespace